Draft DXF ist ein Softwaremodul, das von den Std Öffnen,
Std Import und
Std Export Befehlen verwendet wird, um das DXF-Dateiformat zu verarbeiten.
From the user's point of view, the DXF import/export module will be loaded automatically when any of those commands are invoked and the file to open, import or export is a DXF file. The main difference between Std Open and the import command is that the former will create a new FreeCAD document and then do the import, whereas the later will import the DXF file and insert the result in the currently active document.
Qcad-Zeichnung nach DXF exportiert, die anschließend in FreeCAD geöffnet wird
Es stehen zwei Import-Module zur Verfügung, die unter Bearbeiten → Einstellungen... → Import-Export → DXF festgelegt werden können: Der eine ist eingebaut, C++ basiert und schnell, der andere ist eine Altlast, in Python kodiert, langsamer und erfordert die Installation einer Erweiterung, kann aber manche Objekte besser verarbeiten und kann feinere FreeCAD-Objekte erstellen. Beide unterstützen alle DXF-Versionen seit R12.
3D-Festkörper innerhalb einer DXF-Datei werden unter einem binären "ACIS/SAT-Blob" gespeichert, der zur Zeit von FreeCAD nicht gelesen werden kann.
Entity | C++ importer | Legacy importer |
---|---|---|
Lines | ✓ | ✓ |
Polylines (and LWPOLYLINES) | ✓ | ✓ |
Arcs | ✓ | ✓ |
Circles | ✓ | ✓ |
Ellipses | ✓ | ✓ |
Splines | ✓ | ✓ |
Texts & MTexts | ✓ | ✓ |
Leaders | ✗ | ✓ |
Layers | ✓ | ✓ |
Points | ✓ | ✓ |
Dimensions | ✓ | ✓ |
Blocks | ✓ (Geometry only; texts, dimensions, and attributes inside blocks are skipped) |
✓ |
Paper space objects | ✓ | ✓ |
3D Faces | ✗ | ✓ |
Es gibt auch zwei Export-Module: Das Altdaten-Export-Modul exportiert in das DXF-Format R12, Das C++ Export-Modul in das DXF-Format R14. Beide Formate können mit vielen Programmen verarbeitet werden.
Feature | C++ exporter (R14) | Legacy exporter (R12) |
---|---|---|
Supported 2D Geometry | All except Bezier curves. Ellipses and Splines are exported natively. | All except Points. Ellipses and B-splines may be inaccurate or exported as polylines. |
Points | ✓ (If the "Export points" preference is enabled) |
✗ |
3D Objects | Edges from faces are exported. Curved edges only if on XY plane. May create duplicate lines. | Exported as flattened 2D views. |
Texts and Dimensions | ✗ | ✓ |
Colors | ✗ | ✓ (Based on object line color) |
Layers | ✓ (Mapped from object names) |
✓ (Mapped from layers and nested groups) |
Compounds | ✗ | ✓ (Exported as blocks) |
Aus lizenzrechtlichen Gründen sind die benötigten DXF Import/Export Bibliotheken, die von der Legacy Version des Importeurs benötigt werden, nicht Teil des FreeCAD Quellcodes. Für weitere Informationen siehe: FreeCAD und DXF Import.
Siehe Import-Export-Einstellungen.
Because the DWG format is a proprietary, closed and undocumented format it is hard for open-source projects like FreeCAD to support it. That is why FreeCAD relies on external converters to read and write DWG files. To import a DWG file a converter is used to create a DXF first, which can then be processed by the FreeCAD DXF importer. When exporting to DWG the opposite conversion happens: the DXF created by the FreeCAD DXF exporter is turned into a DWG.
Note that the DXF format allows a 1:1 conversion of the DWG format. All applications that can read and write DWG files can do the same with DXF files, with no data loss. So asking for DXF files instead of DWG files, and supplying DXF files in turn, should not cause any problems.
There is built-in support for the following DWG converters:
See Import Export Preferences and FreeCAD and DWG Import for more information.
Siehe auch: Autogenerierte API-Dokumentation und Grundlagen der Skripterstellung in FreeCAD.
Um Objekte in eine DXF-Datei zu exportieren, wird die Methode export
des Moduls importDXF verwendet.
importDXF.export(objectslist, filename, nospline=False, lwPoly=False)
filename
verwendet.Beispiel:
import FreeCAD as App
import Draft
import importDXF
doc = App.newDocument()
polygon1 = Draft.make_polygon(3, radius=500)
polygon2 = Draft.make_polygon(5, radius=1500)
doc.recompute()
objects = [polygon1, polygon2]
importDXF.export(objects, "/home/user/Pictures/myfile.dxf")